package com.ruoyi.user.controller;

import com.ruoyi.common.core.cg.result.Result;
import com.ruoyi.user.service.AiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("ai")
public class AiController {
    @Autowired
    private AiService service;
    @RequestMapping("chat")
    public Result chat(String question){
        try {
            return service.chat(question);
        }catch (Exception e){
            e.printStackTrace();
            return new Result(false,"回复失败");
        }
    }
}
